<template>
  <view style="background: #f9f9f9;height: 100vh;">
    <view class="msg-box" v-for="item in msgList" :key="item.uid" @click="goDetails(item.uid)">
      <view class="msg-tit">
        {{ item.title }}
      </view>
      <view class="msg-list">
        <view class="msg-list-left">
          <view class="msg-list-tit">
            {{ item.overview }}
          </view>
          <view class="msg-list-time">
            {{ item.createTime }}
          </view>
        </view>
        <image :src="item.img" class="msg-img" alt="" />
      </view>
    </view>
    <!-- 		<u-loadmore color="#007AFF" :content-text="contentText" @clickLoadMore="clickLoadMore"
			:status="status" /> -->
  </view>
</template>

<script>
import {
  getMsgList
} from '../../api/index.js'
import urlConfig from "../../request/urlConfig.js";
export default {
  data() {
    return {
      searchForm: {
        pageNumber: 1,
        pageSize: 10,
        patientShowFlag: '是'
      },
      msgList: [],
      urlConfig: '',
      contentText: {
        contentdown: '查看更多',
        contentrefresh: '加载中',
        contentnomore: '没有更多'
      },
      status: 'more'
    }
  },
  created() {
    // this.urlConfig = urlConfig.imageUrl
    console.log('urlConfig', urlConfig);

    this.getList()
  },
  onShow() {
    // this.urlConfig = urlConfig.imageUrl
    // this.getList()
  },
  methods: {
    getList() {
      getMsgList(this.searchForm).then(res => {
        console.log('res', res);
        if (res.code == 200) {
          this.msgList = res.data.rows.map(item => {
            return {
              ...item,
              img: urlConfig.baseURL + '/backstage' + item.cover
            }
          })
          console.log('this.msgList', this.msgList);

          this.status = 'more'
        }
      })
    },
    goDetails(uid) {
      uni.navigateTo({
        url: `/chronicDisease/pages/message/detailsMsg?uid=${uid}`
      })
    },
    clickLoadMore() {
      console.log(1111111)
      this.status = 'loading'
      this.searchForm.pageNumber++
      this.getList()
    }
  }
}
</script>

<style>
.msg-box {
  margin: 20rpx 0;
  background: #ffffff;
}

.msg-list {
  display: flex;
  overflow: hidden;
}

.msg-tit {
  margin: 10rpx 30rpx 30rpx 30rpx;
  padding-top: 30rpx;
  font-size: 40rpx;
  line-height: 60rpx;
  font-weight: bold;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-list-left {
  width: 520rpx;
}

.msg-img {
  width: 200rpx;
  height: 160rpx;
  border-radius: 30rpx;
}

.msg-list-tit {
  height: 80rpx;
  margin: 0 30rpx 30rpx 30rpx;
  font-size: 30rpx;
  line-height: 40rpx;
  color: #666;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-list-time {
  margin: 30rpx 0 30rpx 30rpx;
  color: #666;
}
</style>